<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('SchoolDistrict/index')}">学区管理</a></li>
        <li><a href="{:url('SchoolDistrict/add')}">添加学区</a></li>
    </ul>
    <div class="row margin-top-20">
        <div class="col-md-2">
            <div class="list-group">
                <a class="list-group-item" href="#A" data-toggle="tab">基本属性</a>
                <a class="list-group-item" href="#B" data-toggle="tab">SEO设置</a>
                <a class="list-group-item" href="#C" data-toggle="tab">模板设置</a>
            </div>
        </div>
        <div class="col-md-8">
            <form class="js-ajax-form form-horizontal" action="{:url('Course/addPost')}" method="post">
                <div class="tab-content">
                    <div class="tab-pane active" id="A">
                        <div class="form-group">
                            <label for="input-parent"  class="col-sm-2 control-label"><span class="form-required">*</span>课程类别</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="parent_id" id="input-parent">
                                    <option value="0">课程类别</option> {$categories_tree}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>课程名称:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-name" name="name">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name1" class="col-sm-2 control-label">(开课时间:)</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-name1" name="sigup_time">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name2" class="col-sm-2 control-label">
                                (报名人数:)</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-name2" name="student_num">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name3" class="col-sm-2 control-label">
                                (报名时间:)</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" id="input-name3" name="startime">
                            </div>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" id="input-name33" name="endtime">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name4" class="col-sm-2 control-label">
                                (提前人群报名时间:)</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" id="input-name4" name="early_starttime">
                            </div>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" id="input-name44" name="early_endtime">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name9" class="col-sm-2 control-label">
                                课程单价</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-name9" name="price">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name5" class="col-sm-2 control-label">
                                课时数:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-name5" name="long">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name6" class="col-sm-2 control-label">
                                课程总价:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-name6" name="price_total">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name7" class="col-sm-2 control-label">
                                可见范围:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-name7" name="status">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-name8" class="col-sm-2 control-label">
                                课程摘要:</label>
                            <div class="col-sm-10">
                                <textarea name="" id="input-name8" cols="115" rows="5" name="briefy">
                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                课程介绍:</label>
                            <div class="col-sm-10">
                                <td>
                                    <script type="text/plain" id="content" name="text"></script>
                                </td>
                            </div>
                        </div>

                    </div>
                    <div class="tab-pane" id="B">
                        <div class="form-group">
                            <label for="input-seo_title" class="col-sm-2 control-label">SEO标题</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-seo_title" name="seo_title">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-seo_keywords" class="col-sm-2 control-label">SEO关键字</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="input-seo_keywords" name="seo_keywords">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-seo_description" class="col-sm-2 control-label">SEO描述</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="seo_description" id="input-seo_description"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
                    <a class="btn btn-default" href="{:url('SchoolDistrict/index')}">{:lang('BACK')}</a>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script>
    (function(){
        var reg=new RegExp('^[0-9]*[.]*[0-9]*$');
        //课程单价不能为空或者不是数字
        $("#input-name9").blur(function()
        {
            console.log(1);
            console.log($(this).val());
            if(!reg.test($(this).val()))
            {
                alert("请输入数字");
                $(this).val('');

            }
            if($(this).val()=="")
            {
                alert("数字为空");
            }
           if($("#input-name5").val()!=='' && reg.test($("#input-name5").val()))
           {
               $val=parseInt($(this).val())*parseInt($("#input-name5").val());
               $("#input-name6").val($val);
           }
        })

        //课时数不能为空或者不是数字
        $("#input-name5").blur(function()
        {
            console.log(1);
            console.log($(this).val());
            if(!reg.test($(this).val()))
            {
                alert("请输入数字");
                $(this).val('');

            }
            if($(this).val()=="")
            {
                alert("数字为空");
            }
            if($("#input-name9").val()!=='' && reg.test($("#input-name9").val()))
            {
                $val=parseInt($(this).val())*parseInt($("#input-name9").val());
                $("#input-name6").val($val);
            }
        })
        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__Public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });
    })();
</script>
</body>
</html>